package phantri.uit.menunhahang;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.RatingBar;
import android.widget.Toast;
import android.view.View.OnClickListener;

public class YkienActivity extends Activity {
	Button btn_ykien;
	RatingBar rat_monan;
	RatingBar rat_douong;
	RatingBar rat_chuongtrinh;
	RatingBar rat_dichvu;
	EditText rat_khac;

	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.ykien);
		btn_ykien = (Button) findViewById(R.id.btn_ykien);
		rat_monan = (RatingBar) findViewById(R.id.rat_monan);
		rat_douong = (RatingBar) findViewById(R.id.rat_douong);
		rat_chuongtrinh = (RatingBar) findViewById(R.id.rat_chuongtrinh);
		rat_dichvu = (RatingBar) findViewById(R.id.rat_dichvu);
		rat_khac = (EditText) findViewById(R.id.rat_khac);
		btn_ykien.setOnClickListener(new OnClickListener() {

			public void onClick(View v) {
				// TODO Auto-generated method stub
				Context context = getApplicationContext();
				String text1 = "Cảm ơn bạn đã hoàn thành phần đánh giá này!";
				String text2 = "Xin đánh giá đầy đủ!";
				if (rat_monan.getRating() != 0 && rat_douong.getRating() != 0
						&& rat_chuongtrinh.getRating() != 0
						&& rat_dichvu.getRating() != 0) {
					Toast toast = Toast.makeText(context, text1,
							Toast.LENGTH_SHORT);
					toast.show();
					Intent int_menu = new Intent(YkienActivity.this,
							MenuActivity.class);
					startActivity(int_menu);
				} else {
					Toast toast = Toast.makeText(context, text2,
							Toast.LENGTH_SHORT);
					toast.show();
				}
			}
		});
		rat_monan.setFocusable(true);
		rat_monan.requestFocus();
	}
}
